package cn.kgc.springboot.controller;


import cn.kgc.springboot.entity.User;
import cn.kgc.springboot.service.UserService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: mosin
 * @version: v1.0  2022/11/2
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/all")
    public List<User> userList(){
        List<User> users = userService.findAll();
        return  users;
    }


    @GetMapping("/page")
    public PageInfo<User> userPage(Integer page,Integer limit){
        PageInfo<User> userPageInfo = userService.userPage(page,limit);
        return  userPageInfo;
    }



}
